<?php $this->headScript()->appendFile(HTTP_HOST.'/js/site-manager/objects.js'); ?>
<?php if (sizeof($this->countries) > 0) { ?>
<div style="position: relative; float: left; width: 100%;">
	<ul id="site-navigate" style="display: none">
	<?php foreach ($this->countries as $k => $v) { ?>
		<li>
			<a href="<?=$this->url(array('module' => 'site-manager', 'controller' => 'country', 'action' => 'index', 'country' => $v['ID']), null, true)?>"><?=$v['Name'] ?></a>
			<?php if (sizeof($this->regions) > 0 ) { ?>
			<ul>
				<?php foreach($this->regions as $r):?>
					<?php if($r['CountryID'] == $v['ID']):?>
						<li><a href="<?=$this->url(array('module' => 'site-manager', 'controller' => 'country', 'action' => 'index', 'region' => $r['ID']), null, true)?>"><?=$r['Name'] ?></a>
							<?php if (sizeof($this->cities) > 0 ) { ?>
							<ul>
								<?php foreach($this->cities as $c):?>
									<?php if($c['RegionID'] == $r['ID']):?>
										<li><a href="<?=$this->url(array('module' => 'site-manager', 'controller' => 'country', 'action' => 'index', 'city' => $c['ID']), null, true)?>"><?=$c['Name'] ?></a>
											<?php if (sizeof($this->locations) > 0 ) { ?>
											<ul>
												<?php foreach($this->locations as $l):?>
													<?php if($l['CityID'] == $c['ID']):?>
														<li><a href="<?=$this->url(array('module' => 'site-manager', 'controller' => 'country', 'action' => 'index', 'location' => $l['ID']), null, true)?>"><?=$l['Name'] ?></a></li>
													<?php endif;?>
												<?php endforeach;?>
											</ul>
											<?php } ?>
										</li>
									<?php endif;?>
								<?php endforeach;?>
							</ul>
							<?php } ?>
						</li>
					<?php endif;?>
				<?php endforeach;?>
			</ul>
			<?php } ?>
		</li>
	<?php } ?>
	</ul>
</div>
<?php }?>


<?php if(sizeOf($this->objects)>0):?>
<?php $i = 1;?>
<div id="cat_table_div">
<table id="cat_table" style="margin-top: 10px;">
	<tr class="head">
		<td class="checkbox_td"></td>
		<td><?=$this->translate('Код')?></td>
		<td></td>
		<td><?=$this->translate('Объект')?></td>
		<td>-</td>
		<td>-</td>
		<td>-</td>
		<td><?=$this->translate('Сортировка')?></td>
		<td colspan="2" class="right_angle"></td>
	</tr>
	<tr class="table_footer cl">
		<td colspan="10" id="footer_ico">
		<div id="table_paging_div"><?=$this->paginationControl($this->objects, 'Sliding', 'pagination.phtml'); ?></div>
		<div id="_add_new_object_div"><a href="<?=$this->url(array('controller' => 'object', 'action' => 'edit', 'addnew' => 1))?>"><img src="<?=HTTP_HOST;?>/images/admin-side/add.png" alt="" class="add_sign"/><?=$this->translate('Добавить объект')?></a></div>
		</td>
	</tr>
	<tr id="subhead">
		<td class="checkbox_td"><input type="checkbox" class="enable_all"></td>
		<td class="_table_code"><input type="text" name="code" id="code_field" maxlength="10"/></td>
		<td>-</td>
		<td><input type="text" name="search_region" id="search_region" maxlength="255"/></td>
		<td class="active_td">-</td>
		<td class="_table_sort_td">-</td>
		<td class="_table_sort_td">-</td>
		<td class="_table_sort_td">-</td>
		<td colspan="2" class="search_image"><img src="<?=HTTP_HOST; ?>/images/controll/zoom.png" alt="" class="zoom_icon"/></td>
	</tr>		
	<?php foreach($this->objects as $obj):?>
		<?php $i++;?>
		<tr class="cl" <?=(!is_int($i/2))?"style='background: #e1e0e0;'":""; ?>>
			<td class="checkbox_td"><input type="checkbox" name="<?=$obj['ID']?>" class="object_ch"></td>
			<td class="_table_code"><?=$obj['ID']?></td>
			<?php $id = $v['ID']; ?>
			<td class="type_td"><img src="<?=HTTP_HOST; ?>/images/controll/file.png" alt="" class="object_type" id="state-<?=$obj['ID']?>"/></td>
			<td class="_table_title"><?=$obj['Name']?></td>
			<td class="active_td"><img src="<?=HTTP_HOST; ?>/images/controll/<?=$obj['Active'] == 0 ? 'inactive.png' : 'active.png'?>" alt="" class="state1" id="state-<?=$obj['ID']?>" title="<?=$obj['Active'] == 0 ? $this->translate('Не активный') : $this->translate('Активный')?>"/></td>
			<td class="edit_td"><img src="<?=HTTP_HOST; ?>/images/controll/item.png" alt="" class="same_obects" title="<?=$this->translate('Сопутствующие обьекты')?>" id="same_<?=$obj['ID'];?>"/></td>
			<td class="edit_td"><img src="<?=HTTP_HOST; ?>/images/controll/special.png" alt="" class="spec_offer_btn" title="<?=$this->translate('Специальное предложение')?>" id="act_<?=$obj['ID'];?>"/></td>
			<td class="_table_sort_td"><input type="text" class="sort_field" name="Sort" value="<?=$obj['Sort']?>"></td>
			<td class="edit_td"><a href="<?=$this->url(array('module' => 'site-manager', 'controller' => 'object', 'action' => 'edit', 'id' => $obj['ID']), null, true)?>"><img src="<?=HTTP_HOST; ?>/images/controll/edit.png" alt="" class="ed-del-btn1" title="<?=$this->translate('Редактировать объект')?>"/></a></td>
			<td class="del_td"><div id="<?=$obj['ID']?>" class="del_o" rel="<?=$obj['Name']?>" ><img src="<?=HTTP_HOST; ?>/images/controll/delete.png" alt=""  class="ed-del-btn1" title="<?=$this->translate('Удалить объект')?>"/></div></td>
		</tr>
	<?php endforeach;?>
	<tr class="table_footer cl">
		<td id="ch" class="checkbox_td"><input type="checkbox" class="enable_all"></td>
		<td colspan="9" id="footer_ico"><div id="group_delete" style="margin: 0px 0px 0px 5px;"><img src="<?=HTTP_HOST; ?>/images/controll/delete.png" alt=""  class="ed-del-btn"/><div id="delete_label"  style="left: 4px;"><?=$this->translate('Удалить')?></div></div>
		<div id="table_paging_div"><?=$this->paginationControl($this->objects, 'Sliding', 'pagination.phtml'); ?></div>
		<div id="_add_new_object_div"><a href="<?=$this->url(array('controller' => 'object', 'action' => 'edit', 'addnew' => 1))?>"><img src="<?=HTTP_HOST;?>/images/admin-side/add.png" alt="" class="add_sign"/><?=$this->translate('Добавить объект')?></a></div>
		</td>
	</tr>
</table>
<div id="table_shadow"></div>
</div>
<?php endif;?>




